<div>
    <table width="100%">
        <thead>
            <tr>
                <th>Id</th>
                <th>Title</th>
                <th>Category</th>
                <th>Auther</th>
                <th>Created</th>
                <th>Updated</th>
                <th>Action</th>
            </tr>
        </thead>
    
        <tbody id="table-list-load" rel="<?php print site_url('article/list_article'); ?>">
        
            <?php $dem = 0; ?>
            <?php foreach($items As $item): ?>
            <tr class="<?php print ( $dem%2 == 0) ? '': 'alt'; ?>">
                <td><?php print $item->id; ?></td>
                <td><a href="<?php print site_url('article/edit/'.$item->id); ?>"><?php print $item->title; ?></a></td>
                <td><?php print $item->category_name; ?></td>
                <td><?php print $item->username; ?></td>
                <td><?php print date_format(date_create($item->created), 'd/m/Y H:m'); ?></td>
                <td><?php print date_format(date_create($item->update), 'd/m/Y H:m'); ?></td>
                <td><button class="btn choose-value" rel="<?php print 'article/'.$item->id.'/'.$item->slug; ?>">Chon</button></td>
            </tr>
            <?php $dem++; ?>
            <?php endforeach; ?>
            <tr>
                <td colspan="7">
                    <ul class="pagination">
                        <?php if($page > 1): ?>
                        <?php $prev = $page -1; ?>
                        <li class="text"><a class="popup-link" href="<?php print site_url('article/list_article_choose/'.$prev); ?>">Previous</a></li>
                        <?php endif; ?>
                        
                        <?php for($i = $page-$space; $i <= $page+$space;$i++): ?>
                            <?php if($i > 0 && $i <= $totalPages): ?>
                                <?php if($i == $page): ?>
                                    <li class="page"><a class="current" href="javascript:void(0);" title=""><?php print $i; ?></a></li>
                                <?php else: ?>
                                    <li><a href="<?php print site_url('article/list_article_choose/'.$i); ?>" title="" class="popup-link"><?php print $i; ?></a></li>
                                <?php endif; ?>
                            <?php endif; ?>
                        <?php endfor; ?>

                        <?php if($page < $totalPages): ?>
                        <?php $next = $page +1; ?>
                        <li class="text"><a class="popup-link" href="<?php print site_url('article/list_article_choose/'.$next); ?>" title="">Next</a></li>
                        <?php endif; ?>
                    </ul>
                </td>
            </tr>
        </tbody>
    </table>
</div>